//
//  OnSaleHeaderView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/10.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "OnSaleHeaderView.h"

@implementation OnSaleHeaderView
{
    GLGWLabel * leftTypeLabel;
    GLGWLabel * rightTypeLabel;
}

-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        GLGWView * garyView = [[GLGWView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(10)) inSuperView:self];
        garyView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        //
        GLGWView * titleTypeView = [[GLGWView alloc] initWithFrame:CGRectMake(0, kHeightProportion_In_iPhoneTriploid(10), KScreenWidth,kHeightProportion_In_iPhoneTriploid(40)) inSuperView:self];
        titleTypeView.backgroundColor = [UIColor whiteColor];
        //
        GLGWLabel * titleLabel = [[GLGWLabel alloc] initWithFont:BOLDSYSTEMFONT(16) theColor:kColor_Rule_Yellow inSuperView:titleTypeView];
        NSString *str = @" 极速交易商品";
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(titleTypeView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(titleTypeView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(9));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        NSMutableAttributedString *muAtt = [GLGWLabel addImageName:@"search_sale" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:str atImageIndex:0];
        NSAttributedString *att1 = [GLGWLabel addImageName:@"search_sale" theImageFram:CGRectMake(str.length, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:str atImageIndex:str.length];
        [muAtt appendAttributedString:att1];
        titleLabel.attributedText = muAtt;

        rightTypeLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:titleTypeView];
        rightTypeLabel.text = @"已上架";
        [rightTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(titleTypeView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(titleLabel.mas_centerY);
//            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        
        GLGWView * lineView = [[GLGWView alloc] initWithInSuperView:titleTypeView];
        lineView.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.left.bottom.equalTo(titleTypeView).offset(0);
            make.height.equalTo(@1);
        }];
    }
    return self;
}

@end
